<?php
/*
+--------------------------------------------------------------------------
|   AffiliStore 2
|   ========================================
|   Web: http://www.affilistore.com
|   Email: admin (at) affilistore (dot) com
|	License Type: AffiliStore 2 is NOT open source software and limitations apply 
|   Licence Info: Visit AffiliStore website and click on 'Licence'
+--------------------------------------------------------------------------
*/
if (isset($_POST['senddetails'])) {

$getUserDetails = mysql_query("SELECT * FROM affiliSt_config");
$userDetails = mysql_fetch_assoc($getUserDetails);
	do {
		if ($userDetails['name'] == 'adUsername') {
		$username = $userDetails['value'];
		}
		if ($userDetails['name'] == 'adPassword') {
		$password = $userDetails['value'];
		}
		if ($userDetails['name'] == 'adEmail') {
		$email = $userDetails['value'];
		}
	} while ($userDetails = mysql_fetch_assoc($getUserDetails));

	if ($_POST['senddetails'] == $email) {
	$subject = 'AffiliStore Admin Sign-In Details';
	$messagea .= "You have requested your AffiliStore Admin username and password\n\nUsername:".$username."\nPassword:".$password."\n\n";
	$runtime = (date("d M Y H:i"));
	$messagea .= "Time of the message: $runtime (server time zone)\n\n";
	mail($email, $subject, $messagea, "From: $email");
	}

}
?>

<h1>AffiliStore Sign-In</h1>
<fieldset>
<legend>Retrieve username and password</legend>
<?php
if (isset($_POST['senddetails'])) {
	if ($_POST['senddetails'] != $email) {
	echo '<strong style="color:red">This is not your registered email, please try again.</strong><br />';
	} else {
	echo '<strong style="color:green">Please check your email for your Sign-In details.</strong><br />';
	}
}
?>
<form action="index.php?forgot=1" method="post" name="sendforgottondetails">
<table cellpadding="4" cellspacing="0" border="0">
<tr>
<td>
<label for="emailad">Enter your email address:</label>
</td>
<td>
<input name="senddetails" type="text" id="emailad" class="adminInput" />
</td>
</tr>
</table>
<input type="submit" value="Send Sign-In Details" class="padSubmit" />
</form>
<br /><br />
<a href="./">Back to Sign-In &raquo;</a>
</label>
</fieldset>